Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump clap to 3.0 #3064

Merged
merged 6 commits into from
Mar 5, 2023
Merged

Bump clap to 3.0 #3064

merged 6 commits into from
Mar 5, 2023

Conversation

zohnannor
Copy link
Contributor

@zohnannor zohnannor commented Aug 21, 2022

Bump clap to v3 which fixes incorrect executable name printing in subcommand's help texts on Windows (it comes as rustup.exe-subcommand in v2). I don't think this issue was reported to rustup but clap-rs/clap#3693
Add clap_complete as some of clap's functionality was moved into this crate.
Fix related tests.

close #2920

@kinnison
Copy link
Contributor

This is a big chunk of change - have you been running this locally too to verify nothing bad happens?

@zohnannor
Copy link
Contributor Author

zohnannor commented Aug 27, 2022

I hadn't, but I will now, although I am not using rustup directly as often (yes, I know, cargo, rustc and others are rustup's proxies) besides updating nightly and stable Rust installations. I am not 100% sure that everything works besides the functionality that is tested using automatic tests, is there something that is not tested, that I should pay my attention to?

@zohnannor
Copy link
Contributor Author

clap v4 got released, might as well update to that version.

@hi-rustin
Copy link
Member

hi-rustin commented Oct 11, 2022

This is a big chunk of change - have you been running this locally too to verify nothing bad happens?

@kinnison What kind of tests do we need to do? I am glad to help review and test this PR.

src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
@hi-rustin
Copy link
Member

Thanks for working on this!

@zohnannor
Copy link
Contributor Author

zohnannor commented Oct 12, 2022

Still working on transition to v4, will be ready in a couple of days.

UPD: Forgot I can convert PR to draft.

@zohnannor zohnannor marked this pull request as draft October 12, 2022 23:34
@hi-rustin
Copy link
Member

Still working on transition to v4, will be ready in a couple of days.

I'd like to bump it up to v3 first and do more tests and release it. Because if we bump it up to v4, then we maybe get more broken changes.

@zohnannor zohnannor marked this pull request as ready for review October 15, 2022 12:50
@zohnannor zohnannor marked this pull request as draft October 15, 2022 12:51
@zohnannor zohnannor marked this pull request as ready for review October 15, 2022 15:06
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
@zohnannor zohnannor mentioned this pull request Oct 15, 2022
@rbtcollins
Copy link
Contributor

rbtcollins commented Dec 8, 2022 via email

@jyn514
Copy link
Member

jyn514 commented Feb 3, 2023

If it helps, the clap migration guide recommends https://docs.rs/trycmd/latest/trycmd/ for testing the help output. To make it easier to see the differences, you could create a commit only adding trycmd, then upgrade clap, then bless the tests - the changes in the help output will show up in the diff, instead of having to reconstruct them from the code changes.

@rbtcollins
Copy link
Contributor

I think that sort of test would be nice.

That said, the main thing is that the new UI will still be usable.

I think my main issue is that the cmd line help syntax line no longer matches the cmd line sections listed below it.

@hi-rustin
Copy link
Member

If it helps, the clap migration guide recommends https://docs.rs/trycmd/latest/trycmd/ for testing the help output. To make it easier to see the differences, you could create a commit only adding trycmd, then upgrade clap, then bless the tests - the changes in the help output will show up in the diff, instead of having to reconstruct them from the code changes.

@zohnannor Do you have time to add this test? If you are busy right now, I can help to add this test first. I think this test is not only useful for this time, but also we can use it in the future upgrade test.

@zohnannor
Copy link
Contributor Author

@hi-rustin yes, pretty busy right now, I'll try to come back to this Soon™.

@jyn514 to clarify, you're suggesting to use trycmd just to make a diff between old and a new output and then remove trycmd or to integrate it in the project's tests suite and leave it there? I could do either. Before that, to see the output diff, I made a little script that wrote output of every $ rustup <SUBCOMMAND> --help to a file and used that on stable rustup and on the new one, then git-diff'ed it :^)

@jyn514
Copy link
Member

jyn514 commented Feb 8, 2023

@jyn514 to clarify, you're suggesting to use trycmd just to make a diff between old and a new output and then remove trycmd or to integrate it in the project's tests suite and leave it there? I could do either. Before that, to see the output diff, I made a little script that wrote output of every $ rustup <SUBCOMMAND> --help to a file and used that on stable rustup and on the new one, then git-diff'ed it :^)

That's up to the rustup maintainers, but I'd personally recommend integrating it with the test suite and leaving it there, that will make #3094 easier too.

@hi-rustin
Copy link
Member

If you are busy right now, I can help to add this test first. I think this test is not only useful for this time, but also we can use it in the future upgrade test.

@hi-rustin yes, pretty busy right now, I'll try to come back to this Soon™.

I am working on adding the trycmd tests.

@hi-rustin hi-rustin mentioned this pull request Feb 11, 2023
@hi-rustin
Copy link
Member

hi-rustin commented Feb 23, 2023

@zohnannor Friendly ping~
Do you have any time to work on this PR? Because I was planning to do a release recently. So if we could get this change out that would be nice. Also, if you don't have time to work on this PR, I can help push your PR forward. I can squash your commits. And try to resolve the conflicts and fix all the tests, if you don't mind. I'm very sorry it took so long to go back and forth to get you to change this PR.

Thanks! 💚 💙 💜 💛 ❤️

@zohnannor
Copy link
Contributor Author

Hey @hi-rustin thank you for caring!

I'm very sorry it took so long to go back and forth to get you to change this PR.

No worries!

I was planning to do a release recently.

May I ask for the deadline date?

I definitely will have time in the next couple (and by couple I mean ~4) of days to work on this again! I want to clarify some details of the changes to CLI API, the main complication for us is timezones :) So soon I'll compile a list of details and ask you to correct some of them if something is not as desired.

@rbtcollins
Copy link
Contributor

I don't know when @hi-rustin was planning a release, but I can say that I have a thing that won't be ready before the weekend, that I really would love to include in the next release. So IMO the time frames are very compatible.

@hi-rustin
Copy link
Member

May I ask for the deadline date?

My original plan was to prepare a release in the first week of next month.

@hi-rustin
Copy link
Member

May I ask for the deadline date?

My original plan was to prepare a release in the first week of next month.

I definitely will have time in the next couple (and by couple I mean ~4) of days to work on this again!

It's would be nice. Thank you very much.

So IMO the time frames are very compatible

Of course. Sounds good. I will wait for those changes. Thanks!

@zohnannor
Copy link
Contributor Author

Hi. I got heavily sick, my plan of finishing this PR in the next couple of days is busted. @hi-rustin you can take and finish it like you said. Thanks for help, very sad I couldn't finish it myself. I still have a #3094 though :)

Sorry again for inconvenience.

@hi-rustin
Copy link
Member

Hi. I got heavily sick, my plan of finishing this PR in the next couple of days is busted.

Ah, I hope you get well soon.

Sorry again for inconvenience.

No worry. Thanks for your contribution!

@hi-rustin hi-rustin marked this pull request as draft February 28, 2023 01:45
@hi-rustin hi-rustin marked this pull request as ready for review March 3, 2023 09:01
Copy link
Member

@hi-rustin hi-rustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

After this PR lands, I'll retest it.

Copy link
Contributor

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might need a rebase or something, some of the diff is a bit odd:

  •    t.skip("tests/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml");
    
  •   t.skip("tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml");
    

src/cli/rustup_mode.rs Show resolved Hide resolved
@hi-rustin
Copy link
Member

this might need a rebase or something, some of the diff is a bit odd:

We just miss it last time. So I changed it in this PR. You can see https://github.com/rust-lang/rustup/blob/master/tests/suite/cli_ui.rs

Copy link
Contributor

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about the new blank line after commands, might make for a little unneeded vertical whitespace on terminals, but nothing to prevent merging.

@hi-rustin
Copy link
Member

I opened a question to ask the clap community. See clap-rs/clap#4745

Copy link
Member

@hi-rustin hi-rustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check again

@hi-rustin
Copy link
Member

I am going to merge this PR right now. @rbtcollins Thanks for your review! @zohnannor Thanks for your contribution!

@hi-rustin hi-rustin merged commit affbdfe into rust-lang:master Mar 5, 2023
@zohnannor zohnannor deleted the bump-clap branch March 5, 2023 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help text for rustup update contains a broken URL when line-broken
5 participants